package com.neusoft.utils.jsp;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.jsp.PageContext;

import com.neusoft.utils.convert.ConvertUtils;
import com.neusoft.utils.string.StringUtil;

public class JoinStrTag extends OutTag { 
	@Override
	public String work(PageContext pageContext) { 
		String[] strs=getParam();
        return StringUtil.joinStr(split, strs);
	}
   private String[] getParam(){
	   List<String> list= new ArrayList<String>();
	   if(null!=p1){
		   list.add(ConvertUtils.toString(p1));
	   }
	   if(null!=p2){
		   list.add(ConvertUtils.toString(p2));
	   }
	   if(null!=p3){
		   list.add(ConvertUtils.toString(p3));
	   }
	   if(null!=p4){
		   list.add(ConvertUtils.toString(p4));
	   }
	   if(null!=p5){
		   list.add(ConvertUtils.toString(p5));
	   }
	   if(null!=p6){
		   list.add(ConvertUtils.toString(p6));
	   }
	   if(null!=p7){
		   list.add(ConvertUtils.toString(p7));
	   }
	  if(list.isEmpty()){
		  return null;
	  }
	  return list.toArray(new String[list.size()]);
   }
	/**
	 *  
	 */
	private static final long serialVersionUID = -7212705156682934668L;
	private String split;
	private Object p1;
	private Object p2;
	private Object p3;
	private Object p4;
	private Object p5;
	private Object p6;
	private Object p7;

	public Object getP1() {
		return p1;
	}
	public void setP1(Object p1) {
		this.p1 = p1;
	}
	public Object getP2() {
		return p2;
	}
	public void setP2(Object p2) {
		this.p2 = p2;
	}
	public Object getP3() {
		return p3;
	}
	public void setP3(Object p3) {
		this.p3 = p3;
	}
	public Object getP4() {
		return p4;
	}
	public void setP4(Object p4) {
		this.p4 = p4;
	}
	public Object getP5() {
		return p5;
	}
	public void setP5(Object p5) {
		this.p5 = p5;
	}
	public Object getP6() {
		return p6;
	}
	public void setP6(Object p6) {
		this.p6 = p6;
	}
	public Object getP7() {
		return p7;
	}
	public void setP7(Object p7) {
		this.p7 = p7;
	}
	public String getSplit() {
		return split;
	}
	public void setSplit(String split) {
		this.split = split;
	}
   
}
